/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SGDE;

import AdvanceMath.Vector2;
import Draw.Image2D;
import Draw.ImageCollection;
import GameGL.GameGL;
import javax.media.opengl.GL;

/**
 *
 * @author kdsweenx
 */
public class ExampleGame extends GameGL{
    float anglePyramid=0f;
    float pyramidUpdate=10f;

    @Override
    public void InitializeAndLoad() {
//        this.startInFullScreen=true;
    }

    @Override
    public void Update() {
       if(keyboard.isKeyDown('f')){
            this.enterFullScreen();
        }
        if(keyboard.isKeyDown('q')){
            this.exitFullScreen();
        }
        if(keyboard.isKeyDown('w')){
            anglePyramid+=pyramidUpdate;
        }
        if(keyboard.isKeyDown('s')){
            anglePyramid-=pyramidUpdate;
        }
        if(keyboard.isKeyDown('p')){
            this.Quit();
        }
    }

    @Override
    public void Render(GL gl, ImageCollection batch) {
        
        Image2D pig=new Image2D("images/mud.png");
        batch.Draw(pig, new Vector2(400,400));
       
//       gl.glBegin(GL.GL_TRIANGLES);
//       gl.glColor3f(1.0f, 0.0f, 0.0f);
//       gl.glVertex3f(0.0f, 1.0f, 0.0f);
//       gl.glColor3f(0f, 1f, 0f);
//       gl.glVertex3f(-1f, -1f, -1f);
//       gl.glColor3f(0f, 0f, 1f);
//       gl.glVertex3f(1f, -1f, 1f);
//       gl.glEnd();
        
        //PYRAMID RENDER
        gl.glLoadIdentity();
        gl.glTranslatef(-1.6f,0.0f,-6f);
        gl.glRotatef(anglePyramid,-0.2f,1.0f,0.0f);
        
        gl.glBegin(GL.GL_TRIANGLES); // of the pyramid

            // Font-face triangle
            gl.glColor3f(1.0f, 0.0f, 0.0f); // Red
            gl.glVertex3f(0.0f, 1.0f, 0.0f);
            gl.glColor3f(0.0f, 1.0f, 0.0f); // Green
            gl.glVertex3f(-1.0f, -1.0f, 1.0f);
            gl.glColor3f(0.0f, 0.0f, 1.0f); // Blue
            gl.glVertex3f(1.0f, -1.0f, 1.0f);

            // Right-face triangle
            gl.glColor3f(1.0f, 0.0f, 0.0f); // Red
            gl.glVertex3f(0.0f, 1.0f, 0.0f);
            gl.glColor3f(0.0f, 0.0f, 1.0f); // Blue
            gl.glVertex3f(1.0f, -1.0f, 1.0f);
            gl.glColor3f(0.0f, 1.0f, 0.0f); // Green
            gl.glVertex3f(1.0f, -1.0f, -1.0f);

            // Back-face triangle
            gl.glColor3f(1.0f, 0.0f, 0.0f); // Red
            gl.glVertex3f(0.0f, 1.0f, 0.0f);
            gl.glColor3f(0.0f, 1.0f, 0.0f); // Green
            gl.glVertex3f(1.0f, -1.0f, -1.0f);
            gl.glColor3f(0.0f, 0.0f, 1.0f); // Blue
            gl.glVertex3f(-1.0f, -1.0f, -1.0f);

            // Left-face triangle
            gl.glColor3f(1.0f, 0.0f, 0.0f); // Red
            gl.glVertex3f(0.0f, 1.0f, 0.0f);
            gl.glColor3f(0.0f, 0.0f, 1.0f); // Blue
            gl.glVertex3f(-1.0f, -1.0f, -1.0f);
            gl.glColor3f(0.0f, 1.0f, 0.0f); // Green
            gl.glVertex3f(-1.0f, -1.0f, 1.0f);

        gl.glEnd(); // of the pyramid
    }
    
}
